﻿using CrossSelling.Core.Configuration;
using CrossSelling.Core.Data.DBConfig;
using CrossSelling.Model.Model;
using System.Data.Entity;

namespace CrossSelling.Core.Data
{
    public class CrossSellingEntities : DbContext
    {
        public CrossSellingEntities() : base(SystemConfiguration.ConnectionString) { }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer<CrossSellingEntities>(null);
            base.OnModelCreating(modelBuilder);
            modelBuilder.Configurations.Add(new BranchConfiguration());
            modelBuilder.Configurations.Add(new CustomersConfiguration());
            modelBuilder.Configurations.Add(new CrossSellingCustomerConfiguration());
            modelBuilder.Configurations.Add(new CrossSellingProductConfiguration());
            modelBuilder.Configurations.Add(new ProductCategoryConfiguration());
            modelBuilder.Configurations.Add(new ProductHandbookProductConfiguration());
            modelBuilder.Configurations.Add(new ProductHandbookProductDetailConfiguration());
            modelBuilder.Configurations.Add(new CustUsedProductInPastConfiguration());
            modelBuilder.Configurations.Add(new ProductSMEByProductHoldingConfiguration());
            modelBuilder.Configurations.Add(new PreApprovedCreditCard87Configuration());
            modelBuilder.Configurations.Add(new PreApprovedCreditCard21Configuration());
            modelBuilder.Configurations.Add(new PreApprovedBilNewConfiguration());
            modelBuilder.Configurations.Add(new PreApprovedWCConfiguration());
            modelBuilder.Configurations.Add(new RateLimitConfiguration());
            modelBuilder.Configurations.Add(new CheckListDocumentConfiguration());
            modelBuilder.Configurations.Add(new ChecklistQuestionConfiguration());
            modelBuilder.Configurations.Add(new ChecklistCustomerConfiguration());
            modelBuilder.Configurations.Add(new ChecklistDocumentByCustomerConfiguration());
            modelBuilder.Configurations.Add(new ChecklistQuestionSubProductResultConfiguration());
            modelBuilder.Configurations.Add(new ChecklistSubProductConfiguration());
            modelBuilder.Configurations.Add(new ChecklistHideDocWhenAnswerConfiguration());
            modelBuilder.Configurations.Add(new SaleContestProgramInfoConfiguration());
            modelBuilder.Configurations.Add(new SaleContestProgramConfiguration());
        }

        public DbSet<Branch> Branchs { get; set; }
        public DbSet<CrossSellingCustomer> CrossSellingCustomers { get; set; }
        public DbSet<Customers> Customers { get; set; }
        public DbSet<CrossSellingProduct> CrossSellingProducts { get; set; }
        public DbSet<ProductCategory> ProductCategorys { get; set; }
        public DbSet<ProductHandbookProduct> ProductHandbookProducts { get; set; }
        public DbSet<ProductHandbookProductDetail> ProductHandbookProductDetails { get; set; }
        public DbSet<CustUsedProductInPast> CustUsedProductInPasts { get; set; }
        public DbSet<ProductSMEByProductHolding> ProductSMEByProductHoldings { get; set; }
        public DbSet<PreApprovedCreditCard87> PreApprovedCreditCard87s { get; set; }
        public DbSet<PreApprovedCreditCard21> PreApprovedCreditCard21s { get; set; }
        public DbSet<PreApprovedBilNew> PreApprovedBilNews { get; set; }
        public DbSet<PreApprovedWC> PreApprovedWCs { get; set; }
        public DbSet<RateLimit> RateLimits { get; set; }
        public DbSet<CheckListDocument> CheckListDocuments { get; set; }
        public DbSet<ChecklistQuestion> ChecklistQuestions { get; set; }
        public DbSet<ChecklistCustomer> ChecklistCustomers { get; set; }
        public DbSet<ChecklistDocumentByCustomer> ChecklistDocumentByCustomers { get; set; }
        public DbSet<ChecklistQuestionSubProductResult> ChecklistQuestionSubProductResults { get; set; }
        public DbSet<ChecklistSubProduct> ChecklistSubProducts { get; set; }
        public DbSet<ChecklistHideDocWhenAnswer> ChecklistHideDocWhenAnswers { get; set; }
        public DbSet<SaleContestProgramInfo> SaleContestProgramInfos { get; set; }
        public DbSet<SaleContestProgram> SaleContestPrograms { get; set; }  
        
    }
}
